Performance.registerGroup({
	name: "dj.primitive",
	
	after: function() {
		document.getElementById("stub").innerHTML = "";
	}
});

Performance.registerTest({
	group: "dj.primitive",
	name: "create: dom.only",
	args: [100, 200, 500, 1000, 1500, 2000, 3000],
	
	run: function(arg) {
		var count = Math.sqrt(arg),
			stub = document.getElementById("stub");

		var root = document.createElement("div");
		root.setAttribute("id", "root");
		root.style.width = "600px";
		root.style.height = "400px";
		root.style.border = "dotted 2px blue";
		
		for(var i = 0; i < count; i++) {
			var group = document.createElement("div");
			group.setAttribute("id", "elem_" + i);
			group.style.width = "180px";
			group.style.height = "90px";
			group.style.display = "inline-block";
			group.style.border = "dashed 1px green";
			
			for(var j = 0; j < count; j++) {
				var child = document.createElement("div");
				child.setAttribute("id", "elem_" + i + "_" + j);
				child.style.width = "30px";
				child.style.height = "20px";
				child.style.display = "inline-block";
				child.style.border = "solid 1px red";
				group.appendChild(child);
			}
			root.appendChild(group);
		}
		stub.appendChild(root);
	}
});

Performance.registerTest({
	group: "dj.primitive",
	name: "create: actions",
	args: [100, 200, 500, 1000, 1500, 2000, 3000],
	
	run: function(arg) {
		var count = Math.sqrt(arg),
			stub = document.getElementById("stub");
		
		var struct = {
			type: "Dom.Element",
			properties: function() {
				return {
					attrs: {
						id: "root"
					},
					styles: {
						width: "600px",
						height: "400px",
						border: "dotted 2px blue"
					}
				};
			}, 
			content: []
		};
		for(var i = 0; i < count; i++) {
			struct.content[i] = {
				type: "Dom.Element",
				properties: function() {
					return {
						attrs: {
							id: "elem_" + i
						},
						styles: {
							width: "180px",
							height: "90px",
							display: "inline-block",
							border: "dashed 1px green"
						}
					};
				},
				content: []
			};
			for(var j = 0; j < count; j++) {
				struct.content[i].content[j] = {
					type: "Dom.Element",
					properties: function() {
						return {
							attrs: {
								id: "elem_" + i + "_" + j
							},
							styles: {
								width: "30px",
								height: "20px",
								display: "inline-block",
								border: "solid 1px red"
							}
						};
					}
				}
			}
		}
		
		var action = new Core.Action.Dom(struct, "div");
		action.attach(stub);
	}
});